#include "drv_led.h"
#include "drv_beep.h"
#include "drv_systick.h"
#include "drv_key.h"
#include "drv_led123.h"
#include "drv_exti.h"
#include "drv_usart.h"

//static uint8_t key_status3=0;
//static uint8_t key_status2=0;
//static uint8_t key_status1=0;



int main(void)
{
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
    drv_led_init();
    drv_beep_init();
	drv_systick_init(168);
	drv_key123_init();
	drv_led123_init();
	drv_exit9_init();
	drv_usart6_init();
	printf("hello 2507 class\r\n");
	
    while (1)
    {

		
     	#if 0
		if(drv_get_key2())
    	{
    		key_status2=~key_status2;
    	}
		if(key_status2)
		{
			drv_beep_open();
		}
		else
		{
			drv_beep_close();
		}
		
		if(drv_get_key3())
    	{
    		key_status3=~key_status3;
    	}
		if(key_status3)
		{
			drv_led_open();
		}
		else
		{
			drv_led_close();
		}

		#elif 0
		if(drv_get_key3())
		{
			key_status1=~key_status1;
		}
		if(key_status3)
		{
			drv_led1_open();
			drv_systick_ms(500);
			drv_led1_close();
			drv_led2_open();
			drv_systick_ms(500);
			drv_led2_close();
			drv_led3_open();
			drv_systick_ms(500);
			drv_led3_close();
			
		}
		else
		{
			drv_led1_close();
			drv_led2_close();
			drv_led3_close();
		}
		#endif

		
    }
}

